package com.secure.core.service;

import java.io.Serializable;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.secure.core.entity.BaseEntity;

@Transactional
public interface IGenericService<T extends BaseEntity<T>, PK extends Serializable>{
	@Transactional(readOnly=true)
	public T findById(PK id);
	
	/**
	 * 实体对象无主键时调用 {@link #create(BaseEntity)}方法，有主键时{@link #update(BaseEntity)}方法
	 */
	@Transactional
	public void save(T entity, boolean isIncrement);
	
	@Transactional
	public void delById(PK id);
	
	@Transactional(readOnly=true)
	public List<T> quaryAll();
		
}
